<?php

namespace app\validate;

use think\Validate;

class VendorsValidate extends Validate
{
    protected $rule = [
        'id' => 'require',
        'name' => 'require',
        'username' => 'require|length:6,20',
        'password' => 'require|length:6,20',
        'contact' => 'require',
        'phone' => 'require|length:11',
        'status' => 'require|in:100,200'
    ];


    protected $message = [
        'name.require' => '请输入供应商名称',
        'username.require' => '请输入用户名',
        'password.require' => '请输入密码',
        'password.length' => '密码长度6-20位',
        'contact.require' => '请输入联系人',
        'phone.require' => '请输入手机号码',
        'phone.length' => '手机号码长度11位',
        'status.require' => '请选择状态',
        'status.in' => '状态值错误',
        'id.require' => '请选择外协组织',


    ];

    protected $scene = [
        'add' => ['name', 'username', 'password', 'contact', 'phone', 'status'],
        'edit' => ['id', 'name', 'username', 'contact', 'phone', 'status'],
        'del' => ['id'],
        'editPassword' => ['id', 'password'],
    ];
}